/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Reports.GenHTMLReport;

import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintStream;

/**
 *
 * @author leng
 */
public class genIndexHTML {
    String      str_filename = "index.html";
    
    String[]    str = { "<html><head><title>Inter-Annotator Agreement</title></head>",
        "<body><ul>",
        "<li><a href=\"Class matcher.html\">Class matcher</a></li>",
        "<li><a href=\"Span matcher.html\">Span matcher</a></li>",
        "<li><a href=\"Class and span matcher.html\">Class and span matcher</a></li>",
        "<li><a href=\"subclassMatcher.html\">subclass matcher</a></li>"
    };

    /**output
     * @return 
     *      return value bigger than 0      : success
     *      return value smaller than 0     : failed
     */
    public int output(String strAbsolutePath){
        try{
            String separator = File.pathSeparator;
            String file = strAbsolutePath + str_filename;            
            FileOutputStream output = new FileOutputStream(file);

            PrintStream p = new PrintStream(output);
            for(int i=0;i< str.length; i++){
                p.append(str[i]);
            }
            p.close();
            return 1;
            
        }catch(Exception ex){
            System.out.println("error 1101101403:: fail to output index.html!!"
                    + ex.toString() );
            return -1;
        }
    }
}
